<template>
    <div>
        <h2>学生姓名:{{stuName}}</h2>
        <h2>学生年龄:{{stuAge}}</h2>
        <button @click="setStuAddress()">给任意组件传参</button>
    </div>
</template>

<script>
    export default {
        name: "student",
        data(){
            return{
                stuName:"胡政",
                stuAge:18,
                stuAddress:"郑州"
            }
        },
        methods:{
            setStuAddress(){
                this.$bus.$emit("getStuAddress",this.stuAddress)
            }
        }
    }
</script>

<style scoped>

</style>